<?php
/**
 * Created by PhpStorm.
 * User: xh
 * Date: 2019/11/22
 * Time: 4:38 PM
 */

namespace weChat\model;


class WeChatAccount
{
    private $list=[
        'A' => [
            'app_id'     => 'wx12de1bffca232a59',
            'app_secret' => 'e9137107a6473808265af981b08bbd00',
            'mch_id'     => '1670753922',
            'key'        => 'wanyijiangrenbingqian88888888888',
            'cert'       => 'jrbq',
            'name'       => 'jrbq',
        ],

    ];

    /** 返回账号信息
     * 1.pit-weChat-Serve-pay
     * @param string $identity
     * @param string $appId
     * @param string $appSecret
     * @param string $mchId
     * @param string $key
     * @param string $cert
     * @return bool
     */
    public function info($identity='A',&$appId='',&$appSecret='',&$mchId='',&$key='',&$cert=''){
        $list = $this->list;
        if(empty($list[$identity])){return false;}
        $appId     = $list[$identity]['app_id'];
        $appSecret = $list[$identity]['app_secret'];
        $mchId     = $list[$identity]['mch_id'];
        $key       = $list[$identity]['key'];
        $cert      = $list[$identity]['cert'];
        return true;
    }

    public  function sol(){
        $list = $this->list;
        $newList = [];
        foreach ($list as $k => $v){
            $newList[] = [
                'identity' => $k,
                'name' => $v['name'],
            ];
        }
        return $newList;
    }

}